package com.example.androidframework.ui.cart

import android.view.View
import androidx.fragment.app.Fragment
import com.example.androidframework.R
import com.example.androidframework.databinding.FragmentCartBinding
import com.martin.lib_base.base.BaseFragment
import com.xuexiang.xui.widget.actionbar.TitleBar

class CartFragment : BaseFragment<FragmentCartBinding, CartViewModel>() {
    override fun getViewModelClass(): Class<CartViewModel> {
        return CartViewModel::class.java
    }

    override fun layoutId(): Int {
        return R.layout.fragment_cart
    }

    override fun initOnViewCreated() {
        // 通过代码设置顶部导航栏的右侧按钮
        setTopBarAction()
    }

    // 设置顶部导航栏的右侧按钮
    private fun setTopBarAction() {
        binding.topBar.addAction(object : TitleBar.ImageAction(R.drawable.img_history_delete) {
            override fun performAction(view: View?) {

            }
        })
    }

    companion object {
        fun getInstance() : Fragment {
            return CartFragment()
        }
    }
}